# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_SysTatic_session_id'
  before_filter :authenticate

  def tira_decimal(string)
    if string.include? ",00"
      string[0..string.index(',00')-1]
    else
      string
    end
  end
  
  def authenticate
    unless session[:user]
      session[:return_to] = request.request_uri
      redirect_to(:controller => "login", :action => "enter", :layout => false)
    end
  end
  
end
